Case (4) Analysis of macro-financial data
Project 2: Analysis of changes in access to basic public health services for rural versus urban residents in China over the past 25 years (chart output)
Using World Bank public data
# -*- coding: utf-8 -*-
"""
Created on Mon Sept 21 8:04:59 2020
@author: mly
"""
import matplotlib.pyplot as plt
import matplotlib as mpl
import numpy as np
import pandas as pd
from matplotlib import ticker
plt.rcParams['font.sans-serif'] = ['SimHei']
mpl.rcParams["axes.unicode_minus"] = False
df = pd.read_csv('basicsanit_china2000to2017.csv')
y = df['rural_sanit']
y1 = df['urban_sanit']
y2 = df['peopl_sanit']
x = df['year']
plt.figure()
ax = plt.gca()
plt.grid(axis="y")
plt.title('农村居民与城市居民享受基本公共卫生服务的变化情况')
plt.ylabel('服务数值')
plt.xlabel('年份')
ax.plot(x, y, '-rp', lw = 1.5, label = 'rural_sanit')
ax.plot(x, y1, '-gp', lw = 1.5, label = 'rural_sanit')
ax.plot(x, y2, '-bp', lw = 1.5, label = 'peopl_sanit')
ax.legend(loc = 'upper right')
plt.show()
Results of the run.